
import 'dart:convert';

import 'package:elmer_tools/common/GlobalState.dart';
import 'package:elmer_tools/common/Utils.dart';
import 'package:elmer_tools/service/ApiConfig.dart';
import 'package:elmer_tools/service/ApiService.dart';

Future<ApiService> createApiService() async {
    String jsonText = await Utils.readJson("service.json");
    
    ApiConfig apiConfig = ApiConfig.fromJson(jsonDecode(jsonText));
    ApiService apiService = ApiService(config: apiConfig);
    GlobalState.apiService = apiService;

    return apiService;
}
